package com.alks.function.controller.finance.fincons;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.RoleCheck;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.finance.fincons.LotNoCheckRequest;
import com.alks.function.data.request.finance.fincons.OrderUnitPriceRequest;
import com.alks.function.service.finance.fincons.OrderUnitPriceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Slf4j
@Api(value = "财务部-工厂-财务咨询查询", tags = {"财务部-指令单价审核"})
@ApiRestController("/OrderUnitPrice")
@RoleCheck(prgIds = {"100505","180506","170601","180301"})
public class OrderUnitPriceController {

    @Autowired
    private OrderUnitPriceService orderUnitPriceService;

    @PostMapping("/getLotNoList")
    @ApiOperation(value = "指令查询",tags = "财务部-指令单价审核")
    public ResponseInfo getLotNoList(@RequestBody OrderUnitPriceRequest request) {
        return orderUnitPriceService.getLotNoList(request);
    }

    @PostMapping("/getLotNoPriceDetail")
    @ApiOperation(value = "指令单价明细查询",tags = "财务部-指令单价审核")
    public ResponseInfo getLotNoPriceDetail(@RequestBody OrderUnitPriceRequest request) {
        //必传质量类型
        return orderUnitPriceService.getLotNoPriceDetail(request);
    }

    @WebLogger
    @PostMapping("/ExportLotNoList")
    @ApiOperation(value = "导出",tags = "财务部-指令单价审核")
    public void ExportLotNoList(@RequestBody OrderUnitPriceRequest request, HttpServletResponse response)  throws IOException  {
        orderUnitPriceService.ExportLotNoList(request,response);
    }

    @PostMapping("/checkLotNoUnitPrice")
    @ApiOperation(value = "检核1/取消检核2",tags = "财务部-指令单价审核")
    public ResponseInfo checkLotNoUnitPrice(@RequestBody LotNoCheckRequest request) {
        return orderUnitPriceService.checkLotNoUnitPrice(request);
    }
}
